<include file="Public:header" />
<include file="Public:leftside" />
<link rel="stylesheet" type="text/css" href="/Store/css/order/order.css" />
<link rel="stylesheet" type="text/css" href="/Store/css/WdatePicker/skin/WdatePicker.css" />
<script src="/Store/css/WdatePicker/WdatePicker.js" type="text/javascript" charset="utf-8"></script>

<div class="main-content" id="mainContent">
	<div class="breadcrumbs breadcrumbs-fixed" id="breadcrumbs">
		<ul class="breadcrumb">
			<li> <i class="icon-home home-icon"></i>
				<a href="/">首页</a>
			</li>
			<li>
				<a href="{:U('Shop/evaluate')}">评论列表</a>
			</li>

		</ul>
	</div>

	<div class="tabmenu">
		<ul class="tab pngFix">
			<li class="active">
				<a href="{:U('Shop/evaluate')}">商品评价</a>
			</li>
		</ul>
	</div>
	<hr class="tabmenu_hr" style="border:1px solid #00C0FF;margin:0 0px 10px 20px;">
	<div class="main">

		<table class="mytable">
			<tbody>
				<tr>
					<form action="{:U('Shop/evaluate')}" method="get" class="form-inline">
					<th style="line-height:33px;">
						评价时间：
						<input type="text" name="startDate" value="{$_GET['startDate']}" class="input-medium" placeholder="请选择开始日期" onclick="WdatePicker()"> &nbsp;-&nbsp;
						<input type="text" name="endDate" value="{$_GET['endDate']}" placeholder="请选择结束日期" class="input-medium" onclick="WdatePicker()"> 评价类型：
						<select name="explain_type">
							<option value="">全部</option>
							<option value="1" <eq name="_GET['explain_type']" value="1">selected</eq>>好评</option> 
							<option value="2" <eq name="_GET['explain_type']" value="2">selected</eq>>中评</option>
							<option value="3" <eq name="_GET['explain_type']" value="3">selected</eq>>差评</option>
						</select>
						<input type="submit" value="搜索" class="btn btn-info btn-sm ">
						<a href="{:U('Shop/evaluate')}" class="btn btn-sm btn-danger">清空</a>
					</th>
					</form>
				</tr>
			</tbody>
		</table>
		<div id="myTabContent" class="tab-content">
			<div class="tab-pane active">
				<table class="table table-striped table-main" border="0">
					<colgroup>

						<col style="width: 10%;">
						<col style="width: 10%;">
						<col style="width: 10%;">
						<col style="width: 7%;">
						<col style="width: 7%;">
						<col style="width: 5%;">
					</colgroup>
					<tbody>
						<tr class="table-title" style="background: white; z-index: 10; border: 1px solid #E3E3E3;">
							<th colspan="3">商品</th>
							<th colspan="2">评价信息</th>
							<th colspan="2" >评价时间</th>
							<th style="padding-right: 35px; text-align: center;">操作</th>
						</tr>

					</tbody>
					<tbody id="productTbody" style="border: 0px;">
						<foreach name="evaluate_list" item="v">
							<php>$i=$key;</php>
						<tr class="tr-title" style=" width: 1502px;background: #F9F9F9">
								
							<td colspan="3">
								<div style="display: inline-block; width: 100%;" class="pro-code">
									<a href="{:U('shop/index',array('id'=>$v['goods_id']))}" target="_blank">
										<span style="margin-right:5px;width:60px;float:left;overflow: hidden;">
											<img src="{$v.shop_image}" style="height: 60px;">
										</span>
										<span style="width: 335px;">{$v.title}</span>
									</a>
								</div>
							</td>
							<td colspan="2">
								<span class="pro-code">评价用户： {$v.member_name}</span><br>
								<span class="pro-code">用户评分： {$v.scores}分</span>
							</td>
							<td colspan="2"><span class="pro-code" >评价时间：{:date('Y-m-d H:i:s',$v['addtime'])}</span></td>
							<td>
								<a href="javascript:;" class="show" data={$i}>查看</a>
							</td>
						</tr>
						<tr style="display: none;" class="pl_{$i}">
							<td colspan="7" style="background: white;">
								<p><b>评价内容:</b><span class="evaluate_content">	{$v['content']}</span><br>
									<span class="evaluate_content" style="margin-left: 50px;">
										<php>$img_array=explode(',',$v['image']);</php>
										<dd class="goods-comment-imgs">
											<foreach name="img_array" item="vo">
											<img src="{$vo}" style="max-height:60px;margin-right:10px;">
											</foreach>
										</dd>
									
								</span></p>
								<notempty name="v.explain_first">
									<p><b>回复内容:</b> <span class="evaluate_reply">{$v.explain_first}</span></p>
								</notempty>
								
							</td>
							<td style="background: white;">
								<div class="cell">
									<div class="bs-docs-example tooltip-demo" style="text-align: left;">
										<a href="javascript:;" data-placement="bottom" data-original-title="回复">
											<span class="edit" style="display: inline-block; width: 100%;text-align: center;margin-top: 15px;" onclick="replyevaluate({$v.id},this)">
												<i class="icon-edit" style="width: initial;"></i>回复
											</span>
										</a>
									</div>
								</div>
							</td>
						</tr>
						<notempty name="v.again_content">
						<tr style="display: none;" class="pl_{$i}">
							<td colspan="7" style="background: white;">
								<p><b>追评内容:</b><span class="evaluate_content">	{$v.again_content}</span><br>
								<span class="evaluate_content" style="margin: 6px 3px 8px 58px;float: left;width: 100%;">
									<php>$img_array=explode(',',$v['again_image']);</php>
																	
										<foreach name="img_array" item="vo">
										<img src="{$vo}" style="max-height:60px;margin-right:10px;">
										</foreach>
									</span>
								</p>
								<notempty name="v.explain_first">
									<p><b>追评回复:</b> <span class="evaluate_reply">{$v.again_explain}</span></p>
								</notempty>
								
							</td>
							<td style="background: white;">
								<div class="cell">
									<div class="bs-docs-example tooltip-demo" style="text-align: left;">
										<a href="javascript:;" data-placement="bottom" data-original-title="回复"><span class="edit" style="display: inline-block; width: 100%;text-align: center;margin-top: 15px;" onclick="replyevaluateAgain({$v.id},this)"><i class="icon-edit" style="width: initial;"></i>回复</span></a>
									</div>
								</div>
							</td>
						</tr>
						</notempty>
						</div>
						</foreach>
					</tbody>
				</table>
			</div>
		
		</div>
	
		<div id="pagination" class="page" style="margin: 15px ">
			
			
			<div class="page-num fr">
				{$evaluate_page}
			</div>
		</div>
		

	</div>

</div>


<script type="text/javascript">
	//回复 弹出框
	function replyevaluate(evaluate_id, event){
		var evaluate_content = $(event).parents('tr').find('.evaluate_content').html();
		var evaluate_reply = $(event).parents('tr').find('.evaluate_reply').html();
		if(evaluate_reply == undefined){
			evaluate_reply = '';
		}
		$("#replyType").val(1);
		$("#myModalLabel").text("评价回复");
		$("#myModaltype").text("评价内容：");
		$("#evaluate").modal('show');
		$("#evaluate_id").val(evaluate_id);
		$("#evaluate_content").html(evaluate_content);
		$("#evaluate_reply").text(evaluate_reply);
	}
	function replyevaluateAgain(evaluate_id, event){
		var evaluate_content = $(event).parents('tr').find('.evaluate_content').html();
		var evaluate_reply = $(event).parents('tr').find('.evaluate_reply').html();
		if(evaluate_reply == undefined){
			evaluate_reply = '';
		}
		$("#replyType").val(2);
		$("#myModalLabel").text("追评回复");
		$("#myModaltype").text("追评内容：");
		$("#evaluate").modal('show');
		$("#evaluate_id").val(evaluate_id);
		$("#evaluate_content").html(evaluate_content);
		$("#evaluate_reply").text(evaluate_reply);
	}
	// 回复提交
	function replyevaluateAjax(){
		var evaluate_id = $("#evaluate_id").val();
		var evaluate_reply = $("#evaluate_reply").val();
		var replyType = $("#replyType").val(); //1为评价回复 2为追评回复
		if(evaluate_reply==''){
			layer.msg('请填写回复内容！！');	
			return false;
		}
		$.ajax({
			type : "post",
			url : "{:U('shop/replyevaluateajax')}",
			async : true,
			data : {
				"evaluate_id" : evaluate_id, 
				"evaluate_reply" : evaluate_reply,
				"replyType" : replyType
			},
			success : function(data) {
				if(data['code'] > 0){
					layer.msg(data['message']);	
					setTimeout("window.location.reload()", 1000)
				}else{
					layer.msg(data['message']);	
				}
			}
		});
	}
$(function(){
	$('.show').click(function(){
		var xx=$(this).html();
		if(xx=='查看'){
			var id=$(this).attr('data');
			$('.pl_'+id).show();
			
			$(this).html('关闭')
		}else{
			var id=$(this).attr('data');
			$('.pl_'+id).hide();
		
			$(this).html('查看')
		}
		
	})

})
</script>
<include file="Public:footer" />
<input type="hidden" name="replyType" id="replyType" value="" />
<div class="modal fade " id="evaluate" tabindex="-1" role="dialog"
	aria-labelledby="myModalLabel" aria-hidden="true">
	<div class="modal-dialog">
		<div class="modal-content">
			<div class="modal-header">
				<button type="button" class="close" data-dismiss="modal"
					aria-hidden="true">&times;</button>
				<h4 class="modal-title" id="myModalLabel">评价回复</h4>
			</div>
			<div class="modal-body">
				<div class="modal-infp-style">
					<table>
						<tr>
							<td id="myModaltype"><b>评价内容：</b></td>
							<td id="evaluate_content"></td>
						</tr>
						<tr>
							<td>回复内容:</td>
							<td><textarea id="evaluate_reply" style="margin-top: 10px;height: 100px;width: 500px;"></textarea></td>
						</tr>
					</table>
				</div>
			</div>
			<div class="modal-footer">
				<input type="hidden" id="evaluate_id" value="">
				<button type="button" class="btn btn-success" 
					onclick="replyevaluateAjax()">保存</button>
				<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
			</div>
		</div>
	</div>
</div>